package com.miszczu.bo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.miszczu.dao.MessagesDao;
import com.miszczu.model.Messagesreceived;
import com.miszczu.model.Users;

@Service
public class MessagesBoImpl implements MessagesBo {

	@Autowired
	MessagesDao messagesDao;
	
	public List<Messagesreceived> getReceivedMessages(Users user) {
		
		return messagesDao.getReceivedMessages(user);
	}

	public Messagesreceived getOneReceivedMessage(Integer id) {

		return messagesDao.getOneReceivedMessage(id);
	}

	@Transactional
	public void deleteReceivedMessage(Integer id) {

		Messagesreceived message = messagesDao.getOneReceivedMessage(id);
		messagesDao.deleteReceivedMessage(message);
		
	}

}
